#include<Wire.h>
#include<LiquidCrystal_I2C.h>
#include<DHT11.h>

LiquidCrystal_I2C lcd(0x27,16,2);
DHT11 dht(2);

#define GD 2500
#define SOIL_PIN A5
#define LIGHT_PIN A4

void setup() {
  lcd.begin();
  lcd.backlight();
  Serial.begin(9600);
  // lcd.setCursor(2,0);
  // lcd.print("void loop ()");
  // lcd.setCursor(3,1);
  // lcd.print("Subscribe" );

}

String temperature = "Temperature:37C";
String humidity = "Humidity:35%";
String soil_humidity = "SoilHumidity:35%";
String light = "Light:100%";
int temp = 0;
int hum = 0;
float shum = 0;
float photo = 0;

void loop() {
  dht.readTemperatureHumidity(temp, hum);
  lcd.clear();

  //TEPERATURE
  lcd.setCursor(0, 0);
  temperature = "Temperature: " + String(temp) + "C";
  lcd.print(temperature);
  Serial.println(temperature);

  //HUMIDITY
  lcd.setCursor(0, 1);
  humidity = "Humidity: " + String(hum) + "%";
  lcd.print(humidity);
  Serial.println(humidity);

  delay(GD);
  lcd.clear();

  //SOIL HUMIDITY
  soil_humidity = "SoilHumidity:" + String(map(analogRead(SOIL_PIN), 0, 1023, 0, 100)) + "%";
  lcd.setCursor(0, 0);
  lcd.print(soil_humidity);

  //light
  light = "Light:" + String(100 - map(analogRead(LIGHT_PIN), 0, 1023, 0, 100)) + "%";;
  lcd.setCursor(0, 1);
  lcd.print(light);
  Serial.println(light);

  delay(GD);
}